package dbms.check;

import dbms.Debug;
import dbms.server.DbmsServer;

public class CheckTopAttr {
	
	int number;
	String attr;
	String table;

	public CheckTopAttr(int n, String a, String t) {
		number = n;
		attr = a;
		table = t;
	}
	
	public boolean IsTopCorrect() {
		int size = DbmsServer.masterPage.tableMap.get(table).table.getTableSchema().getInfo().size();
		return (number >= size);
	}

	public void check() {
		if (!IsTopCorrect()) Debug.Error("The number " + number + "exceeds the total number of records!");
	}

}
